package com.activitys;

import android.os.Bundle;
import android.text.SpannableString;
import android.text.Spanned;
import android.text.style.RelativeSizeSpan;
import android.view.View;

import com.alibaba.android.arouter.facade.annotation.Route;
import com.example.pay.R;
import com.example.pay.databinding.ActivityPayFinishBinding;
import com.homegoods.aroutercomment.ARouterPath;
import com.kedll.library.base.MyBaseFragmentActivity;
import com.kedll.library.mvp.BasePresenter;
import com.kedll.library.util.ToastUtil;


@Route(path = ARouterPath.PATH_PAY_FINISH)
public class PayFinishActivity extends MyBaseFragmentActivity<ActivityPayFinishBinding, BasePresenter> {

    @Override
    protected int getLayout() {
        return R.layout.activity_pay_finish;
    }

    @Override
    protected void initToolBar(Bundle savedInstanceState) {
        super.initToolBar(savedInstanceState);
        appBarLayout.setBackgroundColor(getResources().getColor(R.color.white));

    }

    @Override
    protected void initEvent() {

    }

    @Override
    protected void initData(Bundle savedInstanceState) {
        super.initData(savedInstanceState);

        String money = "￥" + "100.00";
        SpannableString spannableString = new SpannableString(money);
        RelativeSizeSpan span1 = new RelativeSizeSpan(0.8f);
        RelativeSizeSpan span2 = new RelativeSizeSpan(0.6f);
        spannableString.setSpan(span1, 0, 1, Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
        spannableString.setSpan(span2, money.indexOf("."), money.length(), Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
        mBinding.tvMoney.setText(spannableString);

        mBinding.tvFinish.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });

        mBinding.tvOrder.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                ToastUtil.showToast("查看订单");
            }
        });


    }

    @Override
    protected BasePresenter getPresenter() {
        return null;
    }
}
